<?php   
    include_once 'controller/follow.php';
    include_once 'controller/login.php';
    $name_logon = $_SESSION['user_name'];
?>

<div class="boxchatlist">
    <input class="buttonChat" type="button" onclick="showSpoiler(this);" value="chatlist" />
    <div class="inner" style="display:none" >
        <form name="" action="" method="">
            <div class="chatlistview">
                <div>
                    <label id="bold">Online Followed Users</label>
                </div>
                <?php
                    $fo = new follow();
                    $lo = new login();
                    $resultFol = $fo->showFollowed($name_logon);
                    while ($rowFol = mysql_fetch_array($resultFol)){
                        if ($lo->isOnline($rowFol['followed'])){
                ?>
                <div>
                    <a href="<?php echo 'chatRoom.php?nameChatWith='.$rowFol['followed'];?>"><?php echo $rowFol['followed'];?></a>
                </div>
                <?php
                        }
                    }
                ?>
                <div class="space"></div>
                <div>
                    <label id="bold">Online Following Users</label>
                </div>
                <?php
                    $resultFolo = $fo->showFollowing($name_logon);
                    while ($rowFolo = mysql_fetch_array($resultFolo)){
                        if ($lo->isOnline($rowFolo['user_name_following'])){
                ?>
                <div>
                    <a href="<?php echo 'chatRoom.php?nameChatWith='.$rowFolo['user_name_following'];?>"><?php echo $rowFolo['user_name_following'];?></a>
                </div>
                <?php
                        }
                    }
                ?>
            </div>
            <div class="chatinput">
                <input type="text" name="usersearch" disabled>
                <input type="submit" name="Search" value="Search" disabled>
            </div>
        </form>
    </div>
</div>